import request from '@/utils/request'

// 获取当前可查看的门店
export function getCanViewStore (query) {
  return request({
    url: '/prod-api/work/selectStoreByWork',
    method: 'get',
    params: query
  })
}

// 获取当前用户基本信息
export function currentUserInfo (query) {
  return request({
    url: '/prod-api/work/getInfo',
    method: 'get',
    params: query
  })
}

// 获取工作台信息
export function workInfo (query) {
  return request({
    url: '/prod-api/work/medical/listWork',
    method: 'get',
    params: query
  })
}

// 创建预约单
export function createOrder (data) {
  return request({
    url: '/prod-api/work/medical/MedicalAdd',
    method: 'post',
    data: data
  })
}

// 根据手机号获取用户id
export function phoneGetInfo (query) {
  return request({
    url: '/prod-api/work/getNameByPhone',
    method: 'get',
    params: query
  })
}

// 医美工作台获取时间
export function workTime (query) {
  return request({
    url: '/prod-api/work/medical/getTime',
    method: 'get',
    params: query
  })
}

// 获取预约详情
export function subscribeDetail(id) {
  return request({
    url: `/prod-api/work/getWorkDetail/${id}`,
    method: 'get',
  })
}

// 预约详情下面的tab
export function subscribeDetailTab(query) {
  return request({
    url: `/prod-api/work/getWorkTab`,
    method: 'get',
    params: query
  })
}

// 服务操作接口  接受/取消/结束/服务记录上传服务
export function serviceOptApi (data) {
  return request({
    url: '/prod-api/work/medical/service',
    method: 'post',
    data: data
  })
}

// 修改次数
export function editTimes (data) {
  return request({
    url: `/prod-api/work/editTimes`,
    method: 'post',
    data:data
  })
}


export function startService ({ uid, data }) {
  return request({
    url: `/prod-api/work/medical/startService/${uid}`,
    method: 'post',
    data
  })
}

// 结束服务
export function endService ({ uid, data }) {
  return request({
    url: `/prod-api/work/medical/endItemBySubscribe/${uid}`,
    method: 'post',
    data
  })
}

// 查询客户当前可以添加的服务项目
export function customerAddProject({ customerUid, storeId }) {
  return request({
    url: `/prod-api/work/medical/subscribeBuyCard/${customerUid}/${storeId}`,
    method: 'get',
  })
}

// 添加服务
export function addProjectRecord (id, data) {
  return request({
    url: `/prod-api/work/medical/addItemBySubscribe/${id}`,
    method: 'post',
    data: data
  })
}

// 删除服务
export function deleteProjectRecord (id) {
  return request({
    url: `/prod-api/work/medical/del/${id}`,
    method: 'post'
  })
}

// 获取治疗师
export function toTherapistList (query) {
  return request({
    url: '/prod-api/work/selectDoctorList',
    method: 'get',
    params: query
  })
}

// 生美工作台
export function lifiWorkInfo (query) {
  return request({
    url: '/prod-api/work/Life/listWorkLife',
    method: 'get',
    params: query
  })
}


// 生美工作台详情
export function lifiWorkDetial ({ uid, Date }) {
  return request({
    url: `/prod-api/work/Life/getWorkDetail/${uid}`,
    method: 'get',
    params: {
      Date
    }
  })
}

// 获取卡包外的项目
export function getOtherCardList () {
  return request({
    url: '/prod-api/work/selectItemBySubscribeBuy',
    method: 'get'
  })
}

// 提交项目
export function submitOtherCardData (uid, data) {
  return request({
    url: `/prod-api/work/medical/addItemBySubscribeBuy/${uid}`,
    method: 'post',
    data: data
  })
}

export function customerSign () {
  return request({
    url: '/prod-api/weCom/selectOptions',
    method: 'get'
  })
}

export function addCustomerSign (data) {
  return request({
    url: '/prod-api/weCom/addLabel',
    method: 'post',
    data
  })
}

export function deleteCustomerSign (infoId) {
  return request({
    url: `/prod-api/weCom/delLabel/${infoId}`,
    method: 'post'
  })
}

// 根据门店和日期获取某个门店的排班时间
export function getStorePlanTime (query) {
  return request({
    url: '/prod-api/work/medical/getStoreTime',
    method: 'get',
    params: query
  })
}

// 关闭门店排班
export function closeStorePlan (storeId, data) {
  return request({
    url: `/prod-api/work/medical/closedPlan/${storeId}`,
    method: 'post',
    data
  })
}

// 开启门店排班
export function openStorePlan (storeId, data) {
  return request({
    url: `/prod-api/work/medical/openPlanByTime/${storeId}`,
    method: 'post',
    data
  })
}

// 恢复时间段
export function restorePlan (data) {
  return request({
    url: `/prod-api/weCom/openPlan`,
    method: 'post',
    data
  })
}

// 保存预约信息
export function saveSubscribeInfo (data) {
  return request({
    url: `/prod-api/work/medicalSave`,
    method: 'post',
    data
  })
}

// 获取发送预约的tip信息
export function getSendsubscribeTip (id) {
  return request({
    url: `/prod-api/weCom/serviceAppointmentById/${id}`,
    method: 'get'
  })
}

// 发送预约
export function toSendsubscribe (query) {
  return request({
    url: `/prod-api/weCom/sendSubscribeTip`,
    method: 'get',
    params: query
  })
}
